package com.example.diffservice.algorithm.git;//package com.example.diffservice.algorithm.git;
//
//import org.eclipse.jgit.diff.DiffEntry;
//import org.eclipse.jgit.errors.IncorrectObjectTypeException;
//import org.eclipse.jgit.errors.MissingObjectException;
//import org.eclipse.jgit.lib.ObjectId;
//import org.eclipse.jgit.revwalk.RevCommit;
//
//import java.io.IOException;
//import java.util.*;
//
//
//public class JGitHelper extends JGitCommand {
//
//    public JGitHelper(String repoPath) {
//        super(repoPath);
//    }
//
//    /**
//     * 输出debug的文件
//     *
//     * @param commitString
//     */
//    public void analyzeOneCommit(IHandleCommit iHandleCommit, String commitString) {
//        try {
//
//            ObjectId commitId = ObjectId.fromString(commitString);
//            RevCommit commit = revWalk.parseCommit(commitId);
//            if (commit.getParents() == null) {
//                return;
//            }
//            Map<String,List<DiffEntry>> changedFiles = this.getCommitParentMappedDiffEntry(commit.getName());
//            iHandleCommit.handleCommit(changedFiles, commitString,commit);
//
//        } catch (MissingObjectException e) {
//            e.printStackTrace();
//        } catch (IncorrectObjectTypeException e) {
//            e.printStackTrace();
//        } catch (IOException e) {
//            e.printStackTrace();
//        }
//    }
//
//    /**
//     * 输出debug的文件
//     *
//     * @param currentCommitString,nexCommitString
//     */
//    public void analyzeTwoCommits(IHandleCommit handleDiffCommits, String currentCommitString, String nexCommitString) {
//        try {
//
//            ObjectId currCommitId = ObjectId.fromString(currentCommitString);
//            RevCommit currCommit = revWalk.parseCommit(currCommitId);
//            ObjectId nextCommitId = ObjectId.fromString(nexCommitString);
//            RevCommit nextCommit = revWalk.parseCommit(nextCommitId);
//            Map<String, List<DiffEntry>> changedFiles = this.getTwoCommitsMappedFileList(currCommit.getName(),nextCommit.getName());
//            handleDiffCommits.handleCommit(changedFiles, currentCommitString,currCommit,nexCommitString,nextCommit);
//
//        } catch (MissingObjectException e) {
//            e.printStackTrace();
//        } catch (IncorrectObjectTypeException e) {
//            e.printStackTrace();
//        } catch (IOException e) {
//            e.printStackTrace();
//        }
//    }
//
//}
